﻿using System;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

public class ScreenshotTest
{
    static public void Main( string[] args )
    {

        //http://support.microsoft.com/kb/147659
        //http://www.codeproject.com/KB/system/snapshot.aspx
        //http://www.codeproject.com/KB/cs/CapturingMinimizedWindow.aspx

        try
        {
            //Bitmap capture = Screenshot.Window.Snap( "Maryann Turgeon" );
            Bitmap capture = Screenshot.Window.Snap( "Office Communicator" );
            //Bitmap capture = Screenshot.Window.Snap();
            //Bitmap capture = Screenshot.Window.SnapDesktop();
            string file = Path.Combine( Environment.CurrentDirectory, "screen.tiff" );
            ImageFormat format = ImageFormat.Tiff;
            capture.Save( file, format );
        }
        catch ( Exception e )
        {
            Console.WriteLine( e );
            Console.ReadKey();
        }

    }
}